package io.ticktick.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import io.ticktick.modules.app.annotation.Login;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.ticktick.modules.app.entity.EmojiEntity;
import io.ticktick.modules.app.service.EmojiService;
import io.ticktick.common.utils.R;



/**
 * 好友列表
 *
 * @author hwf
 * @email zhongku0225@gmail.com
 * @date 2019-11-13 17:15:19
 */
@RestController
@RequestMapping("app/emoji")
public class EmojiController {
    @Autowired
    private EmojiService emojiService;

    /**
     * 列表
     */
    @Login
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){

        return R.ok();
    }


    /**
     * 信息
     */
    @Login
    @RequestMapping("/info/{userId}")
    public R info(@PathVariable("userId") Long userId){
		EmojiEntity emoji = emojiService.getById(userId);

        return R.ok().put("emoji", emoji);
    }

    /**
     * 保存
     */
    @Login
    @RequestMapping("/save")
    public R save(@RequestBody EmojiEntity emoji){
		emojiService.save(emoji);

        return R.ok();
    }

    /**
     * 修改
     */
    @Login
    @RequestMapping("/update")
    public R update(@RequestBody EmojiEntity emoji){
		emojiService.updateById(emoji);

        return R.ok();
    }

    /**
     * 删除
     */
    @Login
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] userIds){
		emojiService.removeByIds(Arrays.asList(userIds));

        return R.ok();
    }

}
